home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / asm32.zip / E32.ZIP / SHOWFKEY.ASM < prev    next >
Assembly Source File  |  1996-08-26  |  3KB  |  165 lines

  1. ; SHOWFKEY.ASM for E32 - Copyright (C) 1994 - 1996 Douglas Herr
  2. ;  all rights reserved
  3.  
  4. ; 01/07/1996 DH: added flashing MARK if mark mode ON
  5. ; 03/22/1996 DH: changed F8 from DEL_EOL to LINE menu
  6.  
  7. include    model.inc
  8.  
  9. public    showfkey
  10. extrn    tputchr:near
  11. extrn    strnlwr:near
  12. extrn    strnupr:near
  13. extrn    i4tostr:near
  14.  
  15. include    dataseg.inc
  16. extrn    normal:byte, inverse:byte
  17. extrn    rows:byte, columns:byte
  18. extrn    cur_posn:word, left_margin:word
  19. extrn    key_status:byte, file_row:dword, dirty_bits:byte
  20. extrn    mark_mode:byte
  21. public    swapmode_prompt
  22.  
  23.     shiftkey equ 3
  24.     ctrl    equ 4
  25.     altb    equ 8
  26.  
  27. nbuff    db 12 dup(0)
  28. fkey    db ' F'
  29. keynum    db '1',0,0
  30.  
  31. altfkeys    db ' NEW ',0,'ROWS',0,'FFEED',0,'COPY',0,' DOS ',0
  32.         db 'UCASE',0,'LOAD',0,'COLUMNS',0,'LCASE',0,' FIND',0
  33. altfkey_len    equ $-altfkeys
  34.  
  35. ; ctrl+Fkey prompts
  36. ctrlfkeys    db '     ',0,'    ',0,'     ',0,'PUSH',0,'POP ',0
  37.         db 'WINDOW',0,'SWAP',0
  38. swapmode_prompt    db '2 files',0,'GO TO',0,' NEXT',0,0
  39. ctrlfkey_len    equ $-ctrlfkeys
  40.  
  41. ; shift+Fkey prompts
  42. shiftfkeys    db  "SETUP",0,"    ",0," PRN",0
  43. mark_msg    db  "MARK",0,"CUT",0,"PASTE",0,"     ",0
  44.         db  "DEL EOL",0,"DEL L",0,"REPLACE",0,0
  45. shiftfkey_len    equ $-shiftfkeys
  46.  
  47. fkeys        db 'UNDO',0,'FIND',0,'PRINT',0
  48. block_msg    db 'BLOCK',0,'GOTO',0,'SCREEN',0,'FILE',0
  49.         db 'LINE',0,'DEL L',0,'UDEL L',0
  50. fkey_len    equ $-fkeys
  51.  
  52. case    dd offset CGROUP:strnlwr
  53.     dd offset CGROUP:strnupr
  54.  
  55. @curseg    ends
  56.  
  57. include    codeseg.inc
  58. ;
  59. ;   this displays the function key prompt and capslock state
  60. ;
  61. showfkey    proc    near
  62.     push    ebp
  63.     and    dirty_bits,11101111b
  64.     mov    word ptr keynum,'1'
  65.  
  66. ; select fkey display
  67.     movzx    eax,key_status    ; gonna use key_status some
  68.                 ; so put it in AL for speed
  69. ; start with ALT test
  70.     lea    ebx,altfkeys
  71.     mov    ecx,altfkey_len
  72.     test    al,altb
  73.     jnz    short c
  74.  
  75. ; test for CTRL key press
  76.     add    ebx,ecx        ; point to Ctrl+FKey prompts
  77.     mov    cx,ctrlfkey_len
  78.     test    al,ctrl
  79.     jnz    short c
  80.  
  81. ; test for Shift key press
  82.     add    ebx,ecx        ; point to shift+FKey prompts
  83.     mov    cx,shiftfkey_len
  84.     test    al,shiftkey
  85.     jnz    short c
  86.  
  87. ; no Alt, Ctrl or Shift
  88.     add    ebx,ecx        ; point to ordinary FKey prompts
  89.     mov    cx,fkey_len
  90.  
  91. ; make the function keys upper case or lower case, depending on
  92. ; CAPSLOCK status
  93. c:
  94.     and    al,64
  95.     rol    al,4        ; EAX either 0 or 4
  96.     call    case[eax]    ; EBX points to prompts, ECX = prompt length
  97.  
  98.     movzx    ebp,columns    ; save number of columns
  99.     mov    dh,rows        ; put prompt at last row
  100.     inc    dh
  101.     xor    dl,dl        ; column zero
  102.     cmp    bp,40
  103.     ja    short c3
  104.     shl    ebp,1
  105. c3:
  106.     mov    ecx,10
  107.     lea    esi,fkey+1    ; start with the numeral
  108.  
  109. f01:    mov    ah,normal
  110.     cmp    keynum,':'
  111.     jne    short f02
  112.     mov    word ptr keynum,'01'
  113. f02:    call    print
  114.  
  115.     mov    ebx,esi        ; save pointer to prompts
  116.     lea    esi,fkey
  117.     inc    keynum
  118.     loop    f01
  119.  
  120. ; clear the remainder of the row
  121.     mov    al,' '        ; space character
  122.     mov    ah,normal
  123.     mov    ecx,ebp
  124.     sub    cl,dl
  125.     jz    short f03
  126. f02d:    call    tputchr
  127.     inc    dl
  128.     loop    f02d
  129. f03:    pop    ebp
  130.     ret
  131.  
  132. showfkey    endp
  133.  
  134. print:
  135.     call    p8
  136.     mov    esi,ebx        ; point to prompts
  137.     mov    ah,inverse
  138.  
  139. ; make MARK blink if mark_mode is ON
  140.     lea    ebx,mark_msg
  141.     sub    ebx,esi
  142.     jnz    short p0
  143.     cmp    mark_mode,bl
  144.     je    short p0
  145.     xor    ah,80h
  146. p0:
  147.     lea    ebx,block_msg
  148.     sub    ebx,esi
  149.     jnz    short p8
  150.     cmp    mark_mode,bl
  151.     je    short p8
  152.     xor    ah,80h
  153.  
  154. p8:
  155.     lodsb
  156.     test    al,al
  157.     jz    short p9
  158.     call    tputchr
  159.     inc    dl        ; next column
  160.     jmp    p8
  161. p9:    ret
  162.  
  163. @curseg    ends
  164.     end
  165.